package com.gitee.candy.thread;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author suYanLong
 * @date 2022年07月14日 17:30
 */
public class ThreadOrderExecFor {

    static ExecutorService executorService = Executors.newSingleThreadExecutor();

    public static void main(String[] args) throws InterruptedException {
        Thread thread1 = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("第一步");
            }
        });

        Thread thread2 = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("第2步");
            }
        });

        Thread thread3 = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("第3步");
            }
        });

        executorService.submit(thread1);
        executorService.submit(thread2);
        executorService.submit(thread3);
    }

}
